package com.array;

public class MyLinkedList {
	MyNode head;
	
	
	public void add(Object data) {
		MyNode node = new MyNode();
		node.data = data;
		if(head == null)
			head = node;
		
		else {
			MyNode current = head;
			while(current.next != null) {
				current = current.next;
			}
			current.next = node;
		}
	}

	public int size() {
	
		if(head == null)
			return 0;
		
		int size = 0;
		MyNode current = head;
		while(current.next != null) {
			size++;
		}
		return size;
	}

}
class MyNode{
	public Object data;
	public MyNode next;
	public MyNode pre;
}